﻿using Battle;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;

namespace ItemComponent
{
    /// <summary>
    /// 不寻找目标，只对正前方发射
    /// </summary>
    public abstract class Gun_Forward: Cannon
    {
        protected override void Update()
        {
            fMarkTime += Time.deltaTime;

            if (bReload)
            {
                if (fMarkTime >= CurGunData.dClipReLoadTime)
                {
                    //换弹时间结束
                    OnReloadOver();
                }
            }

            if (!bReload)
            {
                FireAsync(null);
                fMarkTime -= CurGunData.dFireInterval;

                if (--nCurClipNum <= 0)
                {
                    //弹夹打空
                    Reload();
                }
            }
        }

        protected override ST_BulletData GetBulletData(ICanHitObj target)
        {
            var data = base.GetBulletData(target);
            data.vTargetPos =data.vBornPos+ Vector3.up;
            return data;
        }
    }
}
